package com.minimalist.lindi.controller;

import com.minimalist.common.config.mybatis.bo.PageResp;
import com.minimalist.common.entity.lindi.vo.subsidyapplicationpaynotice.LindiSubsidyApplicationPayNoticeQueryVO;
import com.minimalist.common.entity.lindi.vo.subsidyapplicationpaynotice.LindiSubsidyApplicationPayNoticeVO;
import com.minimalist.common.response.R;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import com.minimalist.lindi.service.LindiSubsidyApplicationPayNoticeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 林地指标交易平台_补贴申请支付通知控制器
 *
 * @author 11987
 */
@Validated
@RestController
@Tag(name = "林地指标交易平台_补贴申请支付通知管理")
@RequestMapping("/lindi/subsidyApplicationPayNotice")
public class LindiSubsidyApplicationPayNoticeController{

    @Autowired
    private LindiSubsidyApplicationPayNoticeService service;

    @PostMapping("/addSubsidyApplicationPayNotice")
    @Operation(summary = "添加补贴申请支付通知")
    public R<?> addSubsidyApplicationPayNotice(
            @RequestBody @Validated(Add.class)
            LindiSubsidyApplicationPayNoticeVO subsidyApplicationPayNoticeVO){
        service.addSubsidyApplicationPayNotice(subsidyApplicationPayNoticeVO);
        return R.ok();
    }

    @DeleteMapping("/deleteSubsidyApplicationPayNoticeBySubsidyApplicationPayNoticeId")
    @Operation(summary = "删除补贴申请支付通知 -> 根据补贴申请支付通知ID删除")
    public R<?> deleteSubsidyApplicationPayNoticeBySubsidyApplicationPayNoticeId(
            @RequestParam("subsidyApplicationPayNoticeId")
            @NotNull(message = "补贴申请支付通知ID不能为空")
            @Parameter(name = "subsidyApplicationPayNoticeId", required = true, description = "补贴申请支付通知ID")
            Long subsidyApplicationPayNoticeId){
        service.deleteSubsidyApplicationPayNoticeBySubsidyApplicationPayNoticeId(subsidyApplicationPayNoticeId);
        return R.ok();
    }

    @PutMapping("/updateSubsidyApplicationPayNoticeBySubsidyApplicationPayNoticeId")
    @Operation(summary = "修改补贴申请支付通知")
    public R<?> updateSubsidyApplicationPayNoticeBySubsidyApplicationPayNoticeId(
            @RequestBody @Validated(Update.class)
            LindiSubsidyApplicationPayNoticeVO subsidyApplicationPayNoticeVO){
        service.updateSubsidyApplicationPayNoticeBySubsidyApplicationPayNoticeId(subsidyApplicationPayNoticeVO);
        return R.ok();
    }

    @GetMapping("/getPageSubsidyApplicationPayNoticeList")
    @Operation(summary = "查询补贴申请支付通知列表(分页)")
    public R<PageResp<LindiSubsidyApplicationPayNoticeVO>> getPageSubsidyApplicationPayNoticeList(
            @RequestBody LindiSubsidyApplicationPayNoticeQueryVO queryVO){
        return R.ok(service.getPageSubsidyApplicationPayNoticeList(queryVO));
    }

    @GetMapping("/getSubsidyApplicationPayNoticeBySubsidyApplicationPayNoticeId/{subsidyApplicationPayNoticeId}")
    @Operation(summary = "根据补贴申请支付通知ID查询补贴申请支付通知")
    public R<LindiSubsidyApplicationPayNoticeVO> getSubsidyApplicationPayNoticeBySubsidyApplicationPayNoticeId(
            @PathVariable(value = "subsidyApplicationPayNoticeId")
            @NotNull(message = "补贴申请支付通知ID不能为空")
            @Parameter(name = "subsidyApplicationPayNoticeId", description = "补贴申请支付通知ID", required = true)
            Long subsidyApplicationPayNoticeId){
        return R.ok(service.getSubsidyApplicationPayNoticeBySubsidyApplicationPayNoticeId(subsidyApplicationPayNoticeId));
    }

    @GetMapping("/getSubsidyApplicationPayNoticeListBySubsidyApplicationId/{subsidyApplicationId}")
    @Operation(summary = "根据补贴申请ID查询支付通知列表")
    public R<List<LindiSubsidyApplicationPayNoticeVO>> getSubsidyApplicationPayNoticeListBySubsidyApplicationId(
            @PathVariable(value = "subsidyApplicationId")
            @NotNull(message = "补贴申请ID不能为空")
            @Parameter(name = "subsidyApplicationId", description = "补贴申请ID", required = true)
            Long subsidyApplicationId){
        return R.ok(service.getSubsidyApplicationPayNoticeListBySubsidyApplicationId(subsidyApplicationId));
    }
}